package com.chenyuxin.ilp.controller.file;

import com.chenyuxin.ilp.ai.interfaces.MistakeAnalysisAssistant;
import com.chenyuxin.ilp.model.dto.file.MistakeAnalyseDto;
import com.chenyuxin.ilp.model.pojo.Result;
import com.chenyuxin.ilp.util.SecurityUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/file/ai")
public class MistakeAnalyseController {
    @Autowired
    private MistakeAnalysisAssistant mistakeAnalysisAssistant;
    @PostMapping("/analyse")
    public Result MistakeAnalyse(@RequestBody MistakeAnalyseDto mistakeAnalyseDto){
        String userId = SecurityUtil.getUserId();
        String aiMessage = mistakeAnalysisAssistant.planAnalysis(mistakeAnalyseDto.getMessage(), userId, mistakeAnalyseDto.getFileId());
        return Result.ok(aiMessage);
    }
}
